package mapper;

import org.springframework.jdbc.core.RowMapper;
import pojo.Dept;
import pojo.User;

import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * @Author: 阮渝轩
 * @Date: 2019/12/5 13:48
 * @Version 1.0
 */
public class DeptMapper implements RowMapper<Dept> {
    //映射机制
    @Override
    public Dept mapRow(ResultSet resultSet, int i) throws SQLException {
        Dept dept=new Dept();
        dept.setDeptId(resultSet.getInt(1));
        dept.setDeptName(resultSet.getString(2));
        dept.setNumber(resultSet.getInt(3));
        System.out.println("当前遍历第："+i);
        return dept;
    }
}